﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;

namespace Arizu.Repository
{
    public class Message
    {
        /// <summary>
        /// 弹出信息后，返回当前页面
        /// </summary>
        /// <param name="message"></param>
        public static void Alertback(object message)
        {
            string js = @"<Script language='JavaScript'>alert('{0}');history.go(-1);</Script>";
            HttpContext.Current.Response.Write(string.Format(js, message.ToString()));
        }
        /// <summary>
        /// 弹出信息提示窗口
        /// </summary>
        /// <param name="message"></param>
        public static void Alert(object message)
        {
            string js = @"<Script language='JavaScript'>
                    alert('{0}');  
                  </Script>";
            HttpContext.Current.Response.Write(string.Format(js, message.ToString()));
        }

        /// <summary>
        /// 刷新父窗口
        /// </summary>
        public static void RefreshParent()
        {
            string js = @"<Script language='JavaScript'>
                    parent.location.reload();
                  </Script>";
            HttpContext.Current.Response.Write(js);
        }

        /// <summary>
        /// 弹出对话框后，执行url
        /// </summary>
        /// <param name="url"></param>
        public static void Alerturl(string url)
        {
            string js = @"<Script language='JavaScript'>location.href='" + url + "';</Script>";
            HttpContext.Current.Response.Write(js);

        }
    }
}
